package Servlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ServiceInterface.ServiceProxy;
import Beans. *;


/**
 * Servlet implementation class DisplayMember
 */
public class DisplayMember extends HttpServlet {
	private static final long serialVersionUID = 1L;
	ServiceProxy proxy = new ServiceProxy();

       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DisplayMember() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Member member;
		try{
			proxy.setEndpoint("http://localhost:8080/VLMS_v2/services/Service");
			member = proxy.displayMember(Integer.parseInt(request.getParameter("id")));
			request.setAttribute("member", member);
			request.getRequestDispatcher("ShowTheMember").forward(request, response);

			
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}

}
